package com.baseDemo.web.controller;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.baseDemo.web.entity.ToolbarMenuEntity;
import com.baseDemo.web.service.toolbarmenu.ToolbarMenuService;

@Controller
@RequestMapping(value = "/toolbarMenu", produces = "application/json;charset=UTF-8")
public class ToolbarMenuController {
	@Resource
	ToolbarMenuService toolbarMenuService;
	
	@RequestMapping(value = "/getToolbarMenuByNav", produces = "application/json;charset=UTF-8")
	@ResponseBody
	public List<ToolbarMenuEntity> getToolbarMenuByNav() {
		return toolbarMenuService.find();
	}
	@RequestMapping(value = "/addToolbarMenu")
	@ResponseBody
	public String addToolbarMenu(@RequestBody ToolbarMenuEntity toolbarMenuEntity) {
		return "{'id':'"+toolbarMenuService.save(toolbarMenuEntity)+"'}";
	}
	@RequestMapping(value = "/destroyToolbarMenu")
	@ResponseBody
	public String destroyToolbarMenu(@RequestBody ToolbarMenuEntity toolbarMenuEntity) {
		return toolbarMenuService.delete(toolbarMenuEntity);
	}
	@RequestMapping(value = "/updateToolbarMenu")
	@ResponseBody
	public String updateToolbarMenu(@RequestBody ToolbarMenuEntity toolbarMenuEntity) {
		return toolbarMenuService.update(toolbarMenuEntity);
	}
}
